/**
 * 
 */
package BESA.Adapter;

import BESA.Agent.Event.DataBESA;
import BESA.Agent.Event.EventBESA;
import BESA.SystemLevel.Directory.AgHandler;
import BESA.util.ReportBESA;

/**
 * @author jcruz
 *
 */
public class AdapterBESA {

	private String eventToSendType;

	private AgHandler agh;


	public AdapterBESA( String eventToSendType, AgHandler agh) {
		this.eventToSendType = eventToSendType;
		this.agh = agh;
	}
	
	public void sendEvent( DataBESA data ){
		EventBESA eventToSend = new EventBESA( this.eventToSendType, data );
		try{
			this.agh.sendEvent( eventToSend );
		}catch( Exception e ){
			ReportBESA.error( "[AdapterBESA::sendEvent] "+e );
		}
	}
	
	public void sendEvent(){
		EventBESA eventToSend = new EventBESA( this.eventToSendType, null );
		try{
			this.agh.sendEvent( eventToSend );
		}catch( Exception e ){
			ReportBESA.error( "[AdapterBESA::sendEvent] "+e );
		}
	}

}
